<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let array = []
    let index = -1
    for (let i = 1; i <= 5; i++) {
      let num = +prompt(`请输入第${i}个数字`)
      array.push(num)
    };
    console.log(array);

    for (let i = 0; i < array.length; i++) {
      if (array[i] === 10) {
        console.log(`10的下标为${i}`);
        break
      } else {
        console.log(index);
      }
    };


  </script>
</body>

</html>